﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.views.components {
    import reprise.ui.*;
    import flash.display.*;
    import net.wooga.pets.utils.*;

    public class GameBackground extends AbstractView {

        private var _rootElement:UIComponent;
        private var _backgroundBitmapData:BitmapData;
        private var _screenshot:Bitmap;
        private var _creditsButton:MovieClip;

        public function GameBackground(_arg1:String, _arg2:Number, _arg3:Number, _arg4:String, _arg5:UIComponent){
            super(_arg1, _arg2, _arg3, _arg4);
            this._rootElement = _arg5;
            _display.cacheAsBitmap = true;
            this._creditsButton = AssetsLibrary.getMovieClip("CreditsButton");
            this._creditsButton.useHandCursor = false;
            this._creditsButton.buttonMode = false;
            this._creditsButton.x = 221;
            this._creditsButton.y = 216;
            this._creditsButton.alpha = 0;
            _display.addChild(this._creditsButton);
        }
        public function setFrame(_arg1:int):void{
            _asset.gotoAndStop(_arg1);
        }
        public function setCachedAsBitmap(_arg1:Boolean):void{
            var _local2:BitmapData;
            if (_arg1){
                _local2 = new BitmapData(width, height, true);
                _local2.draw(this);
                this._screenshot = new Bitmap(_local2);
                _display.addChild(this._screenshot);
                _display.removeChild(_asset);
                _display.removeChild(this._creditsButton);
            } else {
                if (this._screenshot){
                    _display.removeChild(this._screenshot);
                    this._screenshot.bitmapData.dispose();
                    this._screenshot = null;
                    _display.addChild(_asset);
                    _display.addChild(this._creditsButton);
                };
            };
        }
        public function setBackgroundColor():void{
            this.topLeftPixelData.lock();
            this.topLeftPixelData.draw(_asset);
            this.topLeftPixelData.unlock();
            this.updateColorBasedTopLeftBmp();
        }
        private function updateColorBasedTopLeftBmp():void{
            var _local1:String = this.topLeftPixelData.getPixel(0, 0).toString(16);
            this._rootElement.setStyle("backgroundColor", ("#" + _local1));
        }
        private function get topLeftPixelData():BitmapData{
            return ((this._backgroundBitmapData = ((this._backgroundBitmapData) || (new BitmapData(1, 1)))));
        }
        override public function remove():void{
            this._backgroundBitmapData.dispose();
            this._backgroundBitmapData = null;
            super.remove();
        }
        public function updateLinkage(_arg1:String, _arg2:String=null):void{
        }
        public function get creditsButton():MovieClip{
            return (this._creditsButton);
        }

    }
}//package net.wooga.pets.views.components 
